function [B_opt, nonzero_inds_opt, min_ic_val] = search_topologies(C, n, p, N, ic_fun)
	nonzero_inds = eye(n);
	pairs = nonzeros(triu(reshape(1:(n^2), n, n), 1));
	min_ic_val = Inf;
	B_opt = [];
	nonzero_inds_opt = [];
	cvx_quiet(1);

	for k=1:length(pairs)
		for inds=transpose(nchoosek(pairs,k))
			nonzero_inds(:) = 0;
			nonzero_inds(inds) = 1;
			nonzero_inds = nonzero_inds + nonzero_inds';
			nonzero_inds(logical(eye(size(nonzero_inds)))) = 1;
			B = constrained_mlm(C, n, p, nonzero_inds);
			X = B'*B;
			nonzero_inds
			ic_val = ic_fun(X, C, n, p, N)
			if ic_val < min_ic_val
				min_ic_val = ic_val;
				B_opt = B;
				nonzero_inds_opt = nonzero_inds;
			end
		end
	end
end
